using System;
using System.Collections;
using System.Collections.Generic;

namespace WoWAddonRefresh.Entities {
	/// <summary>
	/// Summary description for DownloadSpan.
	/// </summary>
	public class DownloadSpan {
		public DateTime Start = DateTime.Now;
		public List<Addon> addons = new List<Addon>();
		public static int RestrictionCount = 30;
		public static TimeSpan RestrictionSpan = new TimeSpan(0,0,0,59,0);
		

		public TimeSpan NeedWait {
			get {
				TimeSpan timeout = RestrictionSpan - (DateTime.Now - Start);
				if ( timeout.Ticks > 0 && addons.Count >= RestrictionCount ) {
					return timeout;
				}
				return new TimeSpan(0,0,0,0,0);
			}
		}

		public bool Active {
			get {
				TimeSpan timeout = RestrictionSpan - (DateTime.Now - Start);
				if ( timeout.Ticks > 0) {
					return true;
				}
				return false;
			}
		}

		public Guid ID = Guid.NewGuid();
	}

	public class DownloadSpanCollection : List<DownloadSpan> {
	}
}
